package com.th.supcom.pds.outdrugreturnapply.client.page;

import net.carefx.framework.container.client.page.IPageEntryPoint;
import net.carefx.framework.container.client.page.PageContext;
import net.carefx.framework.reflection.shared.annotations.Reflectable;

import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.th.supcom.pds.outdrugreturnapply.client.common.OutDrugReturnApplyModuleEvents;
import com.th.supcom.pds.outdrugreturnapply.client.mvc.OutDrugReturnApplyController;

/**
 * 门诊退药 入口类实现.
 * 
 * @author yzhang
 */
@Reflectable
public class OutDrugReturnApplyEntryPoint implements IPageEntryPoint
{
    /** 提交路径. */
    public static final String SCC_BRANCH = "$URL$";

    /** 提交日期. */
    public static final String SCC_LAST_MODIFICATION_DATE = "$Date$";

    /** 最终修改人员. */
    public static final String SCC_LAST_MODIFIER_NAME = "$Author$";

    /** 最终版本号. */
    public static final String SCC_REVISION = "$Revision$";

    private OutDrugReturnApplyController m_controller;

    @Override
    public void start (final PageContext context)
    {
        m_controller = new OutDrugReturnApplyController ();
        Dispatcher.get ().addController (m_controller);
        context.getWorkBench ().getBodyView ().getWorkspace ().getContextView ().asLayoutContainer ().hide ();
        final AppEvent appEvent = new AppEvent (OutDrugReturnApplyModuleEvents.UI_INIT, context);
        m_controller.handleEvent (appEvent);
    }

    @Override
    public void stop (final PageContext context)
    {
        if (m_controller != null)
        {
            Dispatcher.get ().removeController (m_controller);
        }
    }
}